﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NetworkInterfaceUtility;

namespace CluelessGame
{
    public enum NIUMessageIDs
    {
        CHAT_MESSAGE,
        PLAYER_NAME_CHANGE,
        GAME_STATE,
        END_MOVE,
        START_GAME,
        MAKE_SUGGESTION,
        DISPROVE_SUGGESTION,
        SKIP_DISPROVE_SUGGESTION,
        MAKE_ACCUSATION,
        CHARACTER_SELECTED,
        MOVE_CHARACTER,
        BEGIN_SELECT_CHARACTERS
    }

    [Serializable()]
    public class ChatMessage : NetworkMessageData
    {
        public ChatMessage(Int32 messageID, String text)
            : base(messageID)
        {
            this.text = text;
        }
        public String text;
    }
    [Serializable()]
    public class PlayerNameChangeMessage : NetworkMessageData
    {
        public PlayerNameChangeMessage(Int32 messageID, String name)
            : base(messageID)
        {
            this.name = name;
        }
        public String name;
    }

    [Serializable()]
    public class GameStateMessage : NetworkMessageData
    {
        public GameStateMessage(
            Int32 messageID,
            Player[] players,
            int playerTurn,
            GameObjects gameObjects
            )
            : base(messageID)
        {
            this.players = players;
            this.playerTurn = playerTurn;
            this.gameObjects = gameObjects;
        }

        public Player[] players;
        public int playerTurn;
        public GameObjects gameObjects;
    }

    [Serializable()]
    public class EndTurnMessage : NetworkMessageData
    {
        public EndTurnMessage(Int32 messageID)
            : base(messageID)
        {
        }
    }

    [Serializable()]
    public class SuccessfulChallengeMessage : NetworkMessageData
    {
        public SuccessfulChallengeMessage(Int32 messageID)
            : base(messageID)
        {
        }
    }

    [Serializable()]
    public class StartGameMessage : NetworkMessageData
    {
        public StartGameMessage(Int32 messageID, Int32 playerTurn)
            : base(messageID)
        {
            this.playerTurn = playerTurn;
        }
        public Int32 playerTurn;
    }

    [Serializable()]
    public class MakeSuggestionMessage : NetworkMessageData
    {
        public MakeSuggestionMessage(Int32 messageID, CrimeCards suggestion)
            : base(messageID)
        {
            this.suggestion = suggestion;
        }
        public CrimeCards suggestion;
    }

    [Serializable()]
    public class DisproveSuggestionMessage : NetworkMessageData
    {
        public DisproveSuggestionMessage(Int32 messageID, Card disproveCard)
            : base(messageID)
        {
            this.disproveCard = disproveCard;
        }
        public Card disproveCard;
    }

    [Serializable()]
    public class SkipDisproveSuggestionMessage : NetworkMessageData
    {
        public SkipDisproveSuggestionMessage(Int32 messageID)
            : base(messageID)
        {
        }
    }

    [Serializable()]
    public class MakeAccusationMessage : NetworkMessageData
    {
        public MakeAccusationMessage(Int32 messageID, CrimeCards accusation)
            : base(messageID)
        {
            this.accusation = accusation;
        }
        public CrimeCards accusation;
    }

    [Serializable()]
    public class CharacterSelectedMessage : NetworkMessageData
    {
        public CharacterSelectedMessage(Int32 messageID, Character character, Character prevCharacter)
            : base(messageID)
        {
            this.character = character;
            this.prevCharacter = prevCharacter;
        }
        public Character character;
        public Character prevCharacter;
    }

    [Serializable()]
    public class MoveCharacterMessage : NetworkMessageData
    {
        public MoveCharacterMessage(Int32 messageID, Character character, Location originalLocation, Location targetLocation)
            : base(messageID)
        {
            this.character = character;
            this.originalLocation = originalLocation;
            this.targetLocation = targetLocation;
        }
        public Character character;
        public Location originalLocation;
        public Location targetLocation;
    }

    [Serializable()]
    public class BeginSelectCharactersMessage : NetworkMessageData
    {
        public BeginSelectCharactersMessage(Int32 messageID)
            : base(messageID)
        {
        }
    }
}
